"use strict";

module.exports = {
  // 在执行数据库升级时调用的函数，创建 t_users 表
  up: async (queryInterface, Sequelize) => {
    const { CHAR, DATE, STRING, UUID, UUIDV4 } = Sequelize;
    await queryInterface.createTable("t_user", {
      id: {
        type: UUID,
        primaryKey: true,
        allowNull: false,
        defaultValue: UUIDV4
      },
      account: { type: STRING(50), allowNull: false },
      name: { type: STRING(50), allowNull: false },
      password: { type: STRING(50), allowNull: false },
      email: { type: STRING(50), allowNull: false },
      mobile: { type: STRING(50), allowNull: true },
      status: { type: CHAR(3), allowNull: true },
        create_user_id: { type: UUID, allowNull: true },
        modify_user_id: { type: UUID, allowNull: true },
      create_time: { type: DATE, allowNull: false },
      modify_time: { type: DATE, allowNull: false }
    });
  },
  // 在执行数据库降级时调用的函数，删除 t_users 表
  down: async queryInterface => {
    await queryInterface.dropTable("t_user");
  }
};
